(function() {
    require.config({
        baseUrl: '/app/',
        paths: {
            'es5-shim': 'lib/es5-shim/es5-shim.min',
            'es6-shim': 'lib/es6-shim/es6-shim.min',
            'babel-polyfill': 'lib/es6-shim/browser-polyfill.min',
            'rcss': 'lib/require-css/css',
            'css-builder': 'lib/require-css/css-builder',
            'normalize': 'lib/require-css/normalize',
            'moment': 'lib/moment.js/moment.min',
            'underscore': 'lib/underscore.js/underscore-min',
            'jquery': 'lib/jquery/jquery.min',
            'jquery-ui': 'lib/jquery/jquery-ui.min',
            'jquery-ui.rotatable': 'lib/jquery/jquery-ui-rotatable.min',
            'clipboard': 'lib/clipboard.js/clipboard.min',
            'bootstrap': 'lib/bootstrap/js/bootstrap.min',
            'angular': 'lib/angular.js/angular.min',
            'angular-route': 'lib/angular.js/angular-route.min',
            'angular-animate': 'lib/angular.js/angular-animate.min',
            'angular-sanitize': 'lib/angular.js/angular-sanitize.min',
            'angular-cookies': 'lib/angular.js/angular-cookies.min',
            'angular-ui-bootstrap': 'lib/angular-ui-bootstrap/ui-bootstrap-tpls.min',
            'angular-toastr': 'lib/angular-toastr/angular-toastr.min',
            'angular-toastr.tpls': 'lib/angular-toastr/angular-toastr.tpls.min',
            'angular-loading-bar': 'lib/angular-loading-bar/loading-bar.min',
            'angular-hotkeys': 'lib/angular-hotkeys/hotkeys.min',
            'tinycolor2': 'lib/angular-color-picker/tinycolor.min',
            'angular-color-picker': 'lib/angular-color-picker/angularjs-color-picker.min',
            'ng-file-upload': 'lib/ng-file-upload/ng-file-upload.min',
            'ng-file-upload-shim': 'lib/ng-file-upload/ng-file-upload-shim.min',
            'showdown': 'lib/ng-showdown/showdown',
            'ng-showdown': 'lib/ng-showdown/ng-showdown.min',
            'highlight': 'lib/highlight.js/highlight.pack',
            'zTree': 'lib/zTree.v3/js/jquery.ztree.all.min',
            'zTree-exhide': 'lib/zTree.v3/js/jquery.ztree.exhide.min',
            'fuzzysearch': 'lib/zTree.v3/js/fuzzysearch',
            'ace': 'lib/ace/ace',
            'ace-language-tools': 'lib/ace/ext-language_tools',
            'prettier': 'lib/prettier/standalone',
            'prettier-babylon': 'lib/prettier/parser-babylon',
            'prettier-postcss': 'lib/prettier/parser-postcss',
            'prettier-yaml': 'lib/prettier/parser-yaml',
            'prettier-markdown': 'lib/prettier/parser-markdown',
            'prettier-html': 'lib/prettier/parser-html',
            'prettier-typescript': 'lib/prettier/parser-typescript',
            'xml-formatter': 'lib/prettier/xml-formatter',
            'sql-formatter': 'lib/prettier/sql-formatter',
            'summernote': 'lib/summernote/summernote.min',
            'summernote.zh-CN': 'lib/summernote/lang/summernote-zh-CN.min',
            'handsontable': 'lib/handsontable/handsontable.full.min',
            'handsontable.zh-CN': 'lib/handsontable/languages/zh-CN.min',
            'zrender':  'lib/zrender/zrender.min'
        },
        shim: {
            'es6-shim': ['es5-shim', 'babel-polyfill'],
            'underscore': { exports: '_' },
            'jquery-ui': ['jquery'],
            'jquery-ui.rotatable': ['jquery-ui'],
            'bootstrap': ['jquery-ui', 'rcss!lib/bootstrap/css/bootstrap.min', 'rcss!lib/font-awesome/css/font-awesome.min'],
            'angular': { deps: ['jquery'], exports: 'angular' },
            'angular-route': ['angular'],
            'angular-animate': ['angular'],
            'angular-sanitize': ['angular'],
            'angular-cookies': ['angular'],
            'angular-ui-bootstrap': ['angular', 'bootstrap'],
            'angular-toastr': ['angular-animate', 'rcss!lib/angular-toastr/angular-toastr.min'],
            'angular-toastr.tpls': ['angular-toastr'],
            'angular-loading-bar': ['angular-animate', 'rcss!lib/angular-loading-bar/loading-bar.min'],
            'angular-hotkeys': ['angular', 'rcss!lib/angular-hotkeys/hotkeys.min'],
            'angular-color-picker': ['angular', 'tinycolor2', 'rcss!lib/angular-color-picker/angularjs-color-picker.min',
                    'rcss!lib/angular-color-picker/angularjs-color-picker-bootstrap.min'],
            'ng-file-upload': ['angular'],
            'ng-file-upload-shim': ['ng-file-upload'],
            'ng-showdown': ['showdown', 'angular-sanitize'],
            'highlight': { deps: ['jquery', 'rcss!lib/highlight.js/styles/googlecode'], exports: 'hljs' },
            'zTree': ['jquery', 'rcss!lib/zTree.v3/css/metroStyle/metroStyle'],
            'zTree-exhide': ['zTree'],
            'fuzzysearch': ['jquery'],
            'ace-language-tools': ['ace'],
            'summernote': ['bootstrap', 'rcss!lib/summernote/summernote.min'],
            'summernote.zh-CN': ['summernote'],
            'handsontable': ['rcss!lib/handsontable/handsontable.full.min'],
            'handsontable.zh-CN': ['handsontable'],
            'app': ['es6-shim', 'underscore', 'angular', 'bootstrap']
        },
        deps: ['build'],
        callback: function(args) {
            require(['ace'], function() {
                ace.config.set('basePath', '/app/lib/ace');
            });
            setTimeout(function() {
                jQuery('.loading').fadeOut().remove();
            }, 500);
        },
        waitSeconds: 60
    });
})();
